package pokeronlab_2014;


import com.biotools.meerkat.Card;

/**
 * @author andras
 *  Az ExpertSystem által kapott információ, amikor tanácsot kérünk tőle
 */
public class ExpertSystemData {
	/**
	 *  A játékosok száma
	 */
	int numPlayers;
	/**
	 *  A fold-ok száma
	 */
	int fold;
	/**
	 *  A call-ok száma
	 */
	int call;
	
	/**
	 * A chechek száma
	 */
	int check;
	/**
	 *  Az emelések száma
	 */
	int bet;
	/**
	 *  A pozíció száma
	 */
	int pos;
	/**
	 *  A saját lapok
	 */
	Card card1, card2;
	/**
	 * @author KPeti
	 *
	 */
	enum handStrength {
		VERY_STRONG, STRONG, MEDIOCRE, SPECULATIVE, MIXED, OTHER
	};
	/**
	 * @author KPeti
	 *
	 */
	enum Actions {
		ALL_FOLD, ONE_CALL, MORE_CALL, ONE_RAISE, ONE_RAISE_CALLS
	};
	/**
	 * @author KPeti
	 *
	 */
	enum Position {
		EARLY, MIDDLE, LATE, SMALLBLIND, BIG_BLIND
	};
	
	/**
	 * @return
	 */
	public handStrength getHandStrength() {
		handStrength hs = null;
		if((card1.getRank() == 12 && card2.getRank() == 12)
				|| ((card1.getRank() == 11 && card2.getRank() == 11))
				|| ((card1.getRank() == 10 && card2.getRank() == 10))
				|| (card1.getRank() == 12 && card2.getRank() == 11)
				|| (card1.getRank() == 11 && card2.getRank() == 12))
			hs = hs.VERY_STRONG;
		else if((card1.getRank() == 9 && card2.getRank() == 9)
				|| ((card1.getRank() == 8 && card2.getRank() == 8))
				|| ((card1.getRank() == 7 && card2.getRank() == 7))
				|| (card1.getRank() == 12 && card2.getRank() == 10)
				|| (card1.getRank() == 10 && card2.getRank() == 12)
				|| (card1.getRank() == 12 && card2.getRank() == 9 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 9 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit()))
			hs = hs.STRONG;
		else if((card1.getRank() == 12 && card2.getRank() == 9 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 9 && card2.getRank() == 12 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 8)
				|| (card1.getRank() == 8 && card2.getRank() == 12)
				|| (card1.getRank() == 11 && card2.getRank() == 10)
				|| (card1.getRank() == 10 && card2.getRank() == 11))
			hs = hs.MEDIOCRE;
		else if((card1.getRank() == 6 && card2.getRank() == 6)
				|| ((card1.getRank() == 5 && card2.getRank() == 5))
				|| ((card1.getRank() == 4 && card2.getRank() == 4))
				|| (card1.getRank() == 3 && card2.getRank() == 3)
				|| ((card1.getRank() == 2 && card2.getRank() == 2))
				|| ((card1.getRank() == 1 && card2.getRank() == 1))
				|| ((card1.getRank() == 0 && card2.getRank() == 0))
				|| (card1.getRank() == 11 && card2.getRank() == 9 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 9 && card2.getRank() == 11 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 11 && card2.getRank() == 8 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 8 && card2.getRank() == 11 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 10 && card2.getRank() == 9 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 9 && card2.getRank() == 10 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 10 && card2.getRank() == 8 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 8 && card2.getRank() == 10 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 9 && card2.getRank() == 8 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 8 && card2.getRank() == 9 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 8 && card2.getRank() == 7 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 7 && card2.getRank() == 8 && card1.getSuit() == card2.getSuit()))
			hs = hs.SPECULATIVE;
		else if((card1.getRank() == 11 && card2.getRank() == 9 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 9 && card2.getRank() == 11 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 8 && card2.getRank() == 11 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 11 && card2.getRank() == 8 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 10 && card2.getRank() == 9 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 9 && card2.getRank() == 10 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 8 && card2.getRank() == 10 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 10 && card2.getRank() == 8 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 9 && card2.getRank() == 8 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 8 && card2.getRank() == 9 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 8 && card2.getRank() == 9 && card1.getSuit() != card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 7 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 7 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 6 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 6 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 5 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 5 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 4 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 4 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 3 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 3 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 2 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 2 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 1 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 1 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 12 && card2.getRank() == 0 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 0 && card2.getRank() == 12 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 11 && card2.getRank() == 7 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 7 && card2.getRank() == 11 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 6 && card2.getRank() == 5 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 5 && card2.getRank() == 6 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 7 && card2.getRank() == 6 && card1.getSuit() == card2.getSuit())
				|| (card1.getRank() == 6 && card2.getRank() == 7 && card1.getSuit() == card2.getSuit()))
			hs = hs.MIXED;
		else
			hs = hs.OTHER;
		return hs;
	}
	
	/**
	 * 
	 */
	public Actions getActions() {
		Actions as = null;
		if(pos - fold == 1)
			as = as.ALL_FOLD;
		else if(pos - fold == 2 && bet == 0)
			as = as.ONE_CALL;
		else if(pos - fold > 2 && bet == 0)
			as = as.MORE_CALL;
		else if(bet == 1 && pos - fold == 2)
			as = as.ONE_RAISE;
		else
			as = as.ONE_RAISE_CALLS;
		return as;
	}
	
	/**
	 * 
	 */
	public Position getPosition() {
		Position ps = null;
		if(pos == 1 || pos == 2 || pos == 3)
			ps = ps.EARLY;
		else if(pos == 4 || pos == 5 || pos == 6)
			ps = ps.MIDDLE;
		else if(pos == 7 || pos == 8)
			ps = ps.LATE;
		else if(pos == 9)
			ps = ps.SMALLBLIND;
		else ps = ps.BIG_BLIND;
		return ps;
	}
}
